package dormatory;

public class DormatoryTestApp {

	public static void main(String args[]) {
		
		DormitoryRepository dormitoryRepository = new DormitoryRepositoryInMemoryImpl();
		DormitoryService dormitoryService = new DormitoryServiceImpl(dormitoryRepository);
		
		// find all of the dorms
		for (Dormitory dorm : dormitoryService.getDormList()) {
			for (Room room : dorm.getRoomList()) {
				// list the people in the rooms
				String roomNumber = room.getNumber();
				for (Person person : room.getPersonList()){
					System.out.println("Room " + roomNumber + " contains: " + person);
				}
				System.out.println("Room " + roomNumber + " has " + room.bedsAvailable() + " beds available");
			}
			// check total beds available for dorm
			System.out.println("Total beds still available for " + dorm.getName() + ": " + dorm.bedsAvailable());
			
			// total guests in system
			System.out.println("Total guests in the " + dorm.getName() + ": " + dorm.totalGuest());
		}
		
		// find a specific dorm
		Dormitory captainsDeck = dormitoryService.getDorm("Captains Deck");
		if (captainsDeck != null) {
			System.out.println("Found the Captains Deck");
		} else {
			System.out.println("The Captains Deck is null");
		}
		
		// create a dorm
		Dormitory poolDeck = new Dormitory("Pool Deck");
		dormitoryService.save(poolDeck);
		
		
		
		
		System.out.println("End of Program");
		
	}
 }

